package com.pay.mapper.wx;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.pay.entity.wx.WxCustRelation;

/**
 * 微信用户和商户关系管理
 * @author jinlei.liao
 *
 */
public interface WxCustRelationMapper {
	
	
	
	

	void insert(WxCustRelation wxCustRelation);
	void update(WxCustRelation wxCustRelation);
	/**
	 * 根据商编查询
	 * @param customerNo
	 * @return
	 */
	WxCustRelation findByCustomerNo(@Param("customerNo")String customerNo);
	/**
	 * 根据openId查询默认商户
	 * @param openId
	 * @return
	 */
	WxCustRelation findIsDefaultByOpenId(@Param("openId")String openId);
	/**
	 * 查询最新一个绑定的商户
	 * @param openId
	 * @return
	 */
	WxCustRelation findLastBindCustByOpenId(@Param("openId")String openId);
	
	List<WxCustRelation> getAllCustByOpenId(@Param("openId")String  openId);
	
	List<WxCustRelation> getAllBindCustByOpenId(@Param("openId")String openId);

	List<WxCustRelation> getAllWxCust(@Param("prefixIndex")Integer prefixIndex,
			@Param("suffixIndex")Integer suffixIndex);
	/**根据id范围查询
	 * @param idStart
	 * @param idEnd
	 * @param bindStatus 
	 * @return
	 */
	List<WxCustRelation> findByIdRange(@Param("idStart")String idStart, @Param("idEnd")String idEnd,@Param("bindStatus")String bindStatus);
	/**
	 * 根据时间和商户类型查询绑定商户
	 * @param startTime
	 * @param endTime
	 * @param custType
	 * @return
	 */
	List<String> getBindingCustByTimeRange(@Param("startTime")Date startTime, @Param("endTime")Date endTime,
			@Param("custType")String custType);

}
